Anant Yardi, an Indian-born software magnate, has taken a majority stake in WeWork following a federal bankruptcy court's decision to transfer control to the company's creditors.